<CFPARAM NAME="projectid" DEFAULT="0">


<CFIF isdefined('form.Action')>
	<CFIF form.Action is "INSERT">
		
<CFQUERY name="addprojects" datasource="#application.dsn#">
INSERT INTO projects (
	name,
	url,
	description

)
VALUES
(
	'#name#',
	'#url#',
	'#description#'

)
</CFQUERY>

		<CFLOCATION url="projects_list.cfm?msg=item has been added">
	
	<CFELSE>
	
	
		
<CFQUERY DATASOURCE="trac_fu" NAME="updateprojects">
UPDATE projects
SET 
name='#name#',
url='#url#',
description='#description#'

WHERE projectid=#projectid#
</CFQUERY>


		<CFLOCATION url="projects_list.cfm?msg=item has been updated">
	
	</CFIF>
</CFIF>

<cfquery datasource="#application.dsn#" name="getprojects">
SELECT * FROM projects
WHERE projectid=#projectid#  
</cfquery>



<FORM action="projects_frmaddedit.cfm" method="post" name="frmprojects">

	<INPUT TYPE="hidden" NAME="projectid" value="<cfoutput>#projectid#</cfoutput>">

<table width="100%" cellspacing="0" cellpadding="0">


		<TR>
			<TD>name</TD>
			<TD><INPUT TYPE="TEXT" NAME="name" VALUE="<cfoutput>#getprojects.name#</cfoutput>"  SIZE="50"></TD>
		</TR>

		<TR>
			<TD>url</TD>
			<TD><INPUT TYPE="TEXT" NAME="url" VALUE="<cfoutput>#getprojects.url#</cfoutput>"  SIZE="255"></TD>
		</TR>

		<TR>
			<TD>description</TD>
			<TD><INPUT TYPE="TEXT" NAME="description" VALUE="<cfoutput>#getprojects.description#</cfoutput>"  SIZE="2147483647"></TD>
		</TR>

	<TR>
		<TD colspan=2>
		<CFIF projectid IS NOT 0>
			<INPUT TYPE="HIDDEN" NAME="Action" VALUE="UPDATE">
			<INPUT TYPE="SUBMIT" VALUE=" UPDATE ">
		<CFELSE>
			<INPUT TYPE="HIDDEN" NAME="Action" VALUE="INSERT">
			<INPUT TYPE="SUBMIT" VALUE=" INSERT ">
		</CFIF>
		</TD>
	</TR>
</TABLE>

</FORM>
